﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<!DOCTYPE html>
<html lang="zh-CN">
<head>

  <%@ include file="/WEB-INF/include/meta.jsp"%>
  <%@ include file="/WEB-INF/include/css.jsp"%>
  
</head>

<body>

  <%@ include file="/WEB-INF/include/header.jsp"%>

  <%@ include file="/WEB-INF/include/menu.jsp"%>

  <div class="container main-content">

    <div class="panel panel-default x-panel x-panel-layout">

      <div class="panel-heading">
        <ol class="breadcrumb">
          <li><a href="${ctx.host}/credit">积分管理</a></li>
          <li class="active">订单管理</li>
        </ol>
      </div>

      <div class="panel-body">

        <div class="col-xs-2 x-panel-layout-left no-horizontal-padding">
          <%@ include file="/WEB-INF/include/submenu.jsp"%>
        </div>

        <div class="col-xs-10 x-panel-layout-right">

          <div class="x-breadcrumb-wrapper">
            <div class="x-breadcrumb clearfix">
              <h2><i class="glyphicon glyphicon-fire"></i>&nbsp;&nbsp;<span>订单管理&nbsp;-&nbsp;优惠券订单</span></h2>
            </div>
          </div>
          
          <div class="form-horizontal clearfix" style="margin-bottom: ${refer == 'search' ? '0' : '20'}px; margin-top: 20px;">
            <c:if test="${refer == 'search'}">
              <div class="form-group pull-left" style="width: 40%; margin-bottom: 0px;">
                <label class="control-label col-xs-4">订单总数：</label>
                <div class="col-xs-3">
                  <p class="form-control-static">${total}</p>
                </div>
              </div>
            </c:if>
            <div class="btn-group pull-right">
              <a href="${ctx.host}/coupon-credit-orders/search${not empty queryString ? '?' : ''}${queryString}" data-target="#" data-toggle="modal" class="btn btn-default x-btn btn-shadow btn-shadow-default">
                <i class="glyphicon glyphicon-search"></i>&nbsp;&nbsp;过滤查询
              </a>
            </div>
          </div>
          <table class="table table-striped table-hover x-table" style="margin-bottom:20px;">
            <thead>
              <tr>
                <th>订单号</th>
                <th>下单用户</th>
                <th>产品</th>
                <th>订单总积分</th>
                <th>学员备注</th>
                <th>有效期</th>
                <th class="text-center">操作</th>
              </tr>
            </thead>
            <tbody>
              <c:forEach var="order" items="${orders}">
                <tr>
                <td>${order.code}<br>
                    <fmt:formatDate value="${order.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
                </td>
                <td style="max-width: 150px;" class="ellipsis">
                   ${order.user.name}（${order.user.wechat.code}）<br>
                   ${order.user.mobile}
                </td>
                <td style="max-width: 160px;" class="ellipsis">${order.product.name}</td>
                <td style="max-width: 60px;" class="ellipsis">${order.price}</td>
                <td  style="max-width: 60px;" class="ellipsis">${order.remarks}</td>
                
                <td  style="max-width: 160px;" class="ellipsis">
             		 <fmt:formatDate value="${order.effectiveStartDate}" pattern="yyyy-MM-dd HH:mm:ss"/><br>
            		 <fmt:formatDate value="${order.effectiveEndDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
                </td>
                <td class="text-center">
                  <a href="${ctx.host}/coupon-credit-orders/${order.id}">详情</a>
                </td>
              </tr>
              </c:forEach>
            </tbody>
          </table>
          
          <div class="form-horizontal clearfix">
            
            <c:if test="${refer == 'search'}">
                <div class="form-group pull-left" style="width: 60%">
                  <label class="control-label col-xs-3">查询总计：</label>
                  <div class="col-xs-4" style="padding-left: 0px;">
                    <p class="form-control-static">${total}条记录</p>
                  </div>
                </div>
            </c:if>

            <jsp:include page="/WEB-INF/include/page.jsp">
              <jsp:param name="url" value="coupon-credit-orders" />
              <jsp:param name="queryString" value="${queryString}" />
            </jsp:include>
            
          </div>

        </div>

      </div>

    </div>

  </div>

  <%@ include file="/WEB-INF/include/script.jsp"%>
  <d:resource root="${ctx.resource}/build" type="script" src="js/page/credit/order/credit-order-list.js">
    <script type="text/javascript">
      require(['page/credit/order/credit-order-list'],function(page){
          page.init();
      })
    </script>
  </d:resource>
</body>
</html>